package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	public class DOMTest extends Sprite
	{
		public function DOMTest()
		{
			if(stage)
				init();
			else
				addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			// entry point
			var outter:Sprite = new RectContainer(10, 10, 200, 200);
			var middle:Sprite = new RectContainer(30, 30, 150 ,150);
			var inner:Sprite = new RectContainer(50, 50, 100 ,100);
			
			outter.name = "外部容器";
			middle.name = "中间容器";
			inner.name = "内部容器";
			
			addChild(outter);
			outter.addChild(middle);
			middle.addChild(inner);
			
			inner.addEventListener(MouseEvent.CLICK, clickHandler);
			middle.addEventListener(MouseEvent.CLICK, clickHandler);
			outter.addEventListener(MouseEvent.CLICK, clickHandler);
		}
		
		private function clickHandler(evt:MouseEvent):void
		{
			trace("事件发生目标：\t" +　evt.target.name);
			trace("正在监听事件的当前目标：\t" +　evt.currentTarget.name);
			trace("事件当前阶段：\t" +　evt.eventPhase);
			trace("==========================================");
		}
	}
}